<?php

class StockistController extends Controller {

    public function actionIndex() {
        $stockist_criteria = new CDbCriteria;
        $stockist_criteria->condition = "stockist_is_active = '1'";
        $stockist_criteria->order = "stockist_state_id ASC";

        $stockist_pagination = new CPagination(sys_stockist::model()->count($stockist_criteria));
        $stockist_pagination->pageSize = Yii::app()->params['stockistPerPage'];
        $stockist_pagination->applyLimit($stockist_criteria);

        $stockist_model = sys_stockist::model()->findAll($stockist_criteria);

        $this->render('index', array('stockist_model' => $stockist_model, 'stockist_pagination' => $stockist_pagination));
    }

}
